package com.belinda.springboot_mybatis.service.impl;

import com.belinda.springboot_mybatis.mapper.MongoDBMapper;
import com.belinda.springboot_mybatis.model.Person;
import com.belinda.springboot_mybatis.service.MongoDBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MongoDBServiceImpl implements MongoDBService {
    @Autowired
    private MongoDBMapper mongoDBMapper;

    public Person savePerson(Person person){
        return mongoDBMapper.save(person);
    }

    public Person findByName(String name){
        return mongoDBMapper.findByName(name);
    }

    public List<Person> findAll(){
        return mongoDBMapper.findAll();
    }
}
